import { Injectable } from '@angular/core';
import {Observable} from "rxjs/Observable";
import {MsgResult} from "../../../../models/msg-result";
import {DamAPI} from "../../peach-constants";
import {RequestUtil} from "../../../../util/request-util";

@Injectable()
export class DataOverviewService {
  constructor(
    private requestUtil : RequestUtil
  ) { }
  getHuanData(obj):Observable<MsgResult>{
    let params = "format=json"+"&endTime="+obj.endTime+"&type="+obj.type;
    return this.requestUtil.get(DamAPI.chainChartData,params);
  }
  getAllPiepicData(obj):Observable<MsgResult>{
    let params = "format=json"+"&endTime="+obj.endTime;
    return this.requestUtil.get(DamAPI.allPiePicData,params);
  }
  getWeatherChartData(obj):Observable<MsgResult>{
    let params = "format=json"+"&endTime="+obj.endTime;
    return this.requestUtil.get(DamAPI.weatherChartData,params);
  }
  getAreaQualityData(obj):Observable<MsgResult>{
    let params = "format=json"+"&endTime="+obj.endTime+"&factor="+obj.factor;
    return this.requestUtil.get(DamAPI.areaQualityData,params);
  }



}
